<?php if($role){ ?>
<div  class="contextual-links-region" id="index-depict-setting-block">
    <div class="contextual-links-wrapper contextual-links-processed">
        <a href="#" class="contextual-links-trigger">配置</a>
        <ul class="contextual-links">
            <li class="views-ui-edit first">
                <a class="white fr manage-index-depict-setting" title="设置" data-code="index_depict_section" href="javascript:void(0);">
                    <i class="fa fa-code"></i></i>&nbsp;HTML
                </a>
            </li>
        </ul>
    </div>
<?php } ?>
    <?php echo $info; ?>
<?php if($role){ ?>
    <script type="text/javascript">
        $(function(){
            $.getContextual("#index-depict-setting-block");
        });
        $(function () {
            var editor = CodeMirror.fromTextArea(document.getElementById("ManageDepictContent"), {
                lineNumbers: true,
                matchBrackets: true,
                indentUnit: 4,
                indentWithTabs: true,
                mode: "application/x-httpd-php",
                enterMode: "keep",
                tabMode: "shift"
            });
            $(".manage-index-depict-setting").live('click',function(){
                var _this = $(this);
                var section_code = _this.attr('data-code');
                var applybox = document.getElementById('manage_index_depict_setting');
                setTimeout(function(){
                    editor.refresh();
                },200);
                art.dialog({
                    zIndex: 10004,
                    title: '涂涂圈设置区块',
                    width: 600,
                    height: 450,
                    content: applybox,
                    id: 'manage-index-depict-setting-id',
                    lock: true,
                    okVal: '设置',
                    ok: function () {
                        var _ok = this;
                        var content = editor.getValue();
                        var type = 3;
                        $.ajax({
                            url:"<?php echo Yii::app()->createUrl('manage/index/html') ?>",
                            type : 'POST',
                            dataType:'json',
                            data:{section_code:section_code,content:content,type:type},
                            beforeSend : function() {
                                art.dialog.Talert('<div id="message-loading">正在设置中ing...</div>',5,false);
                            },
                            success : function (data) {
                                if(data['status']==1){
                                    _ok.close();
                                    art.dialog.Talert('<div id="message-ok">'+data['message']+'</div>',1,false);
                                }else{
                                    art.dialog.Talert('<div id="message-error">'+data['message']+'</div>',1,false);
                                }
                            }
                        });
                    },
                    cancelVal: '关闭',
                    cancel: true //为true等价于function(){}
                });
            });
        });
    </script>
</div>
    <div id="manage_index_depict_setting" style="display: none;">
        <div style="width:600px;height:400px;float:left">
            <label for="ManageDepictContent" style="text-align: left;width: 50px;float:left">HTML</label>
            <div style="margin-left: 70px;">
                <textarea id="ManageDepictContent" ><?php echo $info; ?></textarea>
            </div>
        </div>
    </div>
<?php } ?>
